#ifndef _CONTROLE_H_
#define _CONTROLE_H_

#include "MatrizRGBA.h"
#include "Eventos.h"
#include <deque>


class Controle;


typedef std::deque<Controle*>       ListaDeControles;


class Controle : public Eventos
{

protected:

    bool            m_bFixo;
    bool            m_bVisivel;
    Controle*       m_parent;
    unsigned short  m_xPos;
    unsigned short  m_yPos;
    unsigned short  m_uLargura;
    unsigned short  m_uAltura;
    unsigned short  m_xPivo;
    unsigned short  m_yPivo;
    unsigned char   m_alpha;
    double          m_angulo;

public:

    Janela*          m_janela;
    MatrizRGBA*      m_pContexto;

    ListaDeControles m_listaCtrl;

public:

    Controle(int cx, int cy, int x, int y);

    ~Controle();

    Controle* Parent() const {return m_parent;}    

    void AdicionarControle(Controle* c);

    unsigned short PosicaoAbsolutaX();
    unsigned short PosicaoAbsolutaY();
    
    void Cursor(LPCTSTR cursor)
    {
        SetCursor(LoadCursor(NULL, cursor));
    }
    
    inline MatrizRGBA& Matriz() const;
    
    void Fixo(bool bFixo);

    bool Fixo();

    void Alpha(unsigned char alpha);

    unsigned char Alpha();

    void Visivel(bool bVisivel);

    bool Visivel();
    
    void PosicaoAbsoluta(unsigned short xPos, unsigned short yPos);
    
    inline unsigned short PosicaoX() const;

    inline unsigned short PosicaoY() const;

    inline unsigned short Largura() const;

    inline unsigned short Altura() const;
    
    virtual void Largura(int cx);
    
    virtual void Altura(int cy);

    void PosicaoX(int x);

    void PosicaoY(int y);
    
    void Deslocar(int xDelta, int yDelta);
    
    void Angulo(double angulo);
    
    double Angulo();
    
};


inline unsigned short Controle::PosicaoX() const
{
    return m_xPos;
}

inline unsigned short Controle::PosicaoY() const
{
    return m_yPos;
}

inline unsigned short Controle::Largura() const
{
    return m_uLargura;
}

inline unsigned short Controle::Altura() const
{
    return m_uAltura;
}

inline MatrizRGBA& Controle::Matriz() const
{
    return *m_pContexto;
}


#endif
